<?php

use think\migration\Migrator;
use think\migration\db\Column;

class AlarmNews extends Migrator
{
    /**
     * 报警提示
     */
    public function change()
    {
        $table = $this->table('alarm_news');

        $table
            // step1:类型
            ->addColumn('alarm_type', 'string', ['limit' => 50, 'comment' => '站点报警/工况报警/重污染报警'])
            ->addColumn('time_type', 'string', ['limit' => 50, 'comment' => '实时/预报'])

            //step2:标题和内容
            ->addColumn('title', 'string', ['limit' => 100, 'comment' => '报警标题'])
            ->addColumn('content', 'text', ['comment' => '报警内容'])

            //step3:已读和未读
            ->addColumn('is_read', 'integer', ['limit' => 2, 'default' => 0, 'comment' => '0未读/1已读'])

            //step4:相关ID
            ->addColumn('region_id', 'integer', ['comment'=>'城市ID',])

            //step5:插入时间
            ->addColumn('create_time', 'string', ['limit' => 50, 'comment' => '插入时间'])

            //注释
            ->setComment('报警提示信息')

            //引擎
            ->setEngine('InnoDB')
            ->save();
    }
}
